Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

http2: stricter settings validation #26811

Closed

Conversation

BridgeAR
Copy link
Member

@BridgeAR BridgeAR commented Mar 20, 2019

This relies upon #26809 and should not yet be merged. I just wanted to open the PR to get it out early.

Update: It is actually not important in what order these PRs land. I'll update what ever comes first.

// cc @nodejs/http2

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

@BridgeAR BridgeAR added the blocked PRs that are blocked by other issues or PRs. label Mar 20, 2019
@nodejs-github-bot nodejs-github-bot added dont-land-on-v6.x http2 Issues or PRs related to the http2 subsystem. labels Mar 20, 2019
The function did not only validate the input so far but it also made
a copy of the input object and returned that copy to the callee
function. That copy was not necessary for all call sites and it was
not obvious that the function did not only validate the input but
that it also returned a copy of it. This makes sure the function does
nothing more than validation and copying is happening in the callee
function when required.
The settings input was not marked as optional in our documentation
but we did not throw an error in those cases. The API does not seem
to be useful without the correct input, so I went for throwing an
error in such cases instead of updating the documentation.
@BridgeAR BridgeAR removed the blocked PRs that are blocked by other issues or PRs. label Mar 20, 2019
@BridgeAR BridgeAR force-pushed the stricter-http2-settings-validation branch from 11e3ca6 to 5c1b27f Compare March 20, 2019 12:57
@BridgeAR BridgeAR added the semver-major PRs that contain breaking changes and should be released in the next major version. label Mar 20, 2019
Copy link
Member

@jasnell jasnell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Allowing settings to be undefined was intentional. Calling http2.getPackedSettings() with an undefined argument and getting back an empty buffer is perfectly legitimate as it would imply that the defaults would be used, or that no actual change to the settings is being made.

@BridgeAR
Copy link
Member Author

@jasnell I am not sure I can follow. The return value will be empty in such case and it is just a no-op, right? In what way is that intentional?

@jasnell
Copy link
Member

jasnell commented Mar 22, 2019

I'm not saying the function cannot be improved, I'm saying that throwing an error if the input is undefined is wrong. It should be perfectly fine is pass in undefined or no argument at all here.

@BridgeAR
Copy link
Member Author

@jasnell since I am on this anyway: what would be the ideal behavior instead? The current behavior does not seem to benefit anyone, so I could just go ahead and implement what you think should be done instead.

@jasnell
Copy link
Member

jasnell commented Mar 22, 2019

As I said, it should be perfectly fine to pass in settings as undefined. That's the behavior I want to see.

@BridgeAR
Copy link
Member Author

That is currently possible, it's just a no-op right now. Should something specific be returned instead of an empty string?

@jasnell
Copy link
Member

jasnell commented Mar 22, 2019 via email

BridgeAR added a commit to BridgeAR/node that referenced this pull request Mar 24, 2019
The settings are currently not required and the callback was not
documented so far.

Refs: nodejs#26811
@BridgeAR
Copy link
Member Author

Closing in favor of #26894

@BridgeAR BridgeAR closed this Mar 25, 2019
BridgeAR added a commit to BridgeAR/node that referenced this pull request Mar 27, 2019
The settings are currently not required and the callback was not
documented so far.

Refs: nodejs#26811

PR-URL: nodejs#26894
Refs: nodejs#26811
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
targos pushed a commit to targos/node that referenced this pull request Mar 27, 2019
The settings are currently not required and the callback was not
documented so far.

Refs: nodejs#26811

PR-URL: nodejs#26894
Refs: nodejs#26811
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
targos pushed a commit that referenced this pull request Mar 27, 2019
The settings are currently not required and the callback was not
documented so far.

Refs: #26811

PR-URL: #26894
Refs: #26811
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
BethGriggs pushed a commit that referenced this pull request Apr 5, 2019
The settings are currently not required and the callback was not
documented so far.

Refs: #26811

PR-URL: #26894
Refs: #26811
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
@BridgeAR BridgeAR deleted the stricter-http2-settings-validation branch January 20, 2020 11:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
http2 Issues or PRs related to the http2 subsystem. semver-major PRs that contain breaking changes and should be released in the next major version.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants